package com.yugao.fintech.framework.core.response;

import com.yugao.fintech.framework.core.constant.WebType;
import com.yugao.fintech.framework.core.utils.ServletUtils;

import javax.servlet.http.HttpServletRequest;
import java.util.Optional;

public class ServletRequestHandlerImpl implements RequestHandler {

    @Override
    public String getHeader(String key) {
        String value = "";
        Optional<HttpServletRequest> request = ServletUtils.getRequest();
        if (request.isPresent()) {
            value = request.get().getHeader(key);
        }
        return value;
    }

    @Override
    public WebType getWebType() {
        return WebType.SERVLET;
    }
}
